package cn.marinda.util;

import cn.marinda.gui.impl.DownloadServerDiaLogImpl;
import cn.marinda.gui.impl.SettingSelectServerCoreFileHelperImpl;
import cn.marinda.gui.impl.SuccessCreateServerDialogImpl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * swing工具类
 *
 * @author admin
 * @date 2022/07/28
 */
public class SwingUtils {

//    下载提示框
    public static DownloadServerDiaLogImpl downloadDialog = null;
    public static SuccessCreateServerDialogImpl createSuccessDialgo = null;
//    已安装插件列表
    public static SettingSelectServerCoreFileHelperImpl settingSelectServerCoreFileHelper;
    /**
     * 排序列表
     *
     * @param list 列表
     *
     * @return {@link List}<{@link Double}>
     */
    @Deprecated
    public static List<Double> sortList(List<String> list){
        List<Double> sortList = new ArrayList<>();
        for(String str : list){
            if(str.indexOf('.') != -1){
                int start = str.indexOf('-');
                int center = str.indexOf(".",str.indexOf('.')+1);
                String newString = str.substring(start+1,center);
                double parseDouble = Double.parseDouble(newString);
                sortList.add(parseDouble);
            }
        }
        return sortList;
    }
}
